using Provausio.Common.Objects;
using TrainingManagement.api.Models.BusinessObjects.Responses;
using TrainingManagement.api.Models.Data.CRUD;
using TrainingManagement.api.Models.Data.CRUD.Employee;

namespace TrainingManagement.api.Models.BusinessLogic.Employee
{
    public class EmployeeDeleteOperation : BusinessOperation<int, GeneralResponse>
    {
        readonly EmployeeDeleteDataSource _employeeDeleteDataSource = new EmployeeDeleteDataSource();

        public override GeneralResponse Run(int input)
        {
            var response = new GeneralResponse();
            if (_employeeDeleteDataSource.Execute(input))
            {
                response.StatusCode = 200;
                response.Message = "Employee was deleted.";
                return response;
            }

            response.StatusCode = 500;
            response.Message = "Employee was not deleted.";
            return response;
        }
    }
}